Repository navigation
Conversation
URL host names are case-insensitive (RFC 3986), but github_blob_to_raw_url compared parsed.netloc against "github.com" case-sensitively. A GitHub file link such as https://GitHub.com/owner/repo/blob/main/app.yml was therefore returned unchanged, so DSL/app imports requested the blob HTML page instead of the raw YAML file and failed to parse it. Compare the network location case-insensitively; the remaining guards (scheme, path shape, blob segment) are untouched. Add a unit test for capitalized hosts and regressions for lowercase hosts, query/fragment preservation, and non-matching URLs.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
Pyrefly Type Coverage
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #46829 +/- ##
==========================================
- Coverage 90.29% 90.29% -0.01%
==========================================
Files 6459 6459
Lines 407508 407482 -26
Branches 81825 81825
==========================================
- Hits 367960 367933 -27
- Misses 33141 33146 +5
+ Partials 6407 6403 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What this changes
libs.url_utils.github_blob_to_raw_urlcomparedparsed.netlocwith the literal"github.com". Because URL host names are case-insensitive (RFC 3986 section 3.2.2), a GitHub blob link whose host contains uppercase letters (https://GitHub.com/...) failed the guard and was returned unchanged, so the DSL/app import paths that call this helper never resolved it to araw.githubusercontent.comfile URL.This PR compares the network location case-insensitively:
The rest of the guard (
httpsscheme, path shape,blobsegment) and the conversion itself are untouched, so non-GitHub hosts, GitHub subdomains,treepaths, and non-HTTPS URLs are still returned unchanged.Tests
Added
api/tests/unit_tests/libs/test_github_blob_url_host_case.py(4 tests): capitalized / mixed-case / uppercase hosts, plus regressions for the lowercase host, query-and-fragment preservation, and non-matching URLs (other host, subdomain,treepath,httpscheme).Verification (isolated worktree based on
origin/main,PYTHONPATH=$PWD,--noconftest):1 failed, 3 passed4 passed1 failed, 3 passed4 passedGates:
ruff check(all checks passed),ruff format --check(2 files already formatted),pyrefly checkwith the default config and with thetests/unit_tests/pyrefly.tomlstrict config (0 diagnostics each),scripts/check_no_new_cast.py(no newtyping.cast), andgit merge-tree --write-tree origin/main <head>(exit 0). The new test uses explicit-> Nonereturn annotations, no empty-container inference, and nopytest.raiseswithoutmatch.Fixes #46827